<?php

/**
 * @author  PVer
 * @date    2018-5-28 17:12:10
 * @version V1.0
 * @desc    
 */

namespace app\daikuan\controller;

use cmf\controller\AdminBaseController;
use app\daikuan\model\DriverInterestModel;

class InterestDriverController extends AdminBaseController {

    public function index() {
        $driverInterestModel = new DriverInterestModel();
        $info = $driverInterestModel->find();
        $this->assign("info", $info);
        return $this->fetch();
    }

    public function addPost() {
        if ($this->request->isPost()) {
            $data = $this->request->post();
            $driverInterestModel = new DriverInterestModel();
//            $arr = array();
//            $arr["flag"] = 1;
//            $driverInterestModel->save($arr, "id!=0");
            $result = $driverInterestModel->save($data, "id=1");
            if ($result !== false) {
                $this->success("操作成功", url("index"));
            } else {
                $this->error("操作失败");
            }
        }
    }

}
